<template>
  <div>
    <el-dialog
      title="提示"
      :visible.sync="dialogVisible"
      width="50%"
      :before-close="handleClose">
      <div>
        <el-form :model="ruleForm" status-icon :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
          <el-form-item label="账号" prop="name">
            <el-input  v-model="ruleForm.name" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item label="姓名" prop="user">
            <el-input v-model="ruleForm.user" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item label="密码" prop="user">
            <el-input v-model="ruleForm.user" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item label="部门" prop="user">
            <el-input type="password" v-model="ruleForm.password" auto-complete="off"></el-input>
          </el-form-item>
          <el-form-item label="职责" prop="age">
            <el-input v-model.number="ruleForm.age"></el-input>
          </el-form-item>
          <el-form-item label="权限" prop="age">
            <el-select v-model="ruleForm.value11" multiple collapse-tags style="margin-left: 20px;" placeholder="请选择">
              <el-option v-for="item in options" :key="item.value":label="item.label" :value="item.value"></el-option>
            </el-select>
          </el-form-item>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="closeFun('ruleForm')">取 消</el-button>
        <el-button type="primary" @click="AdduserFun('ruleForm')">确 定</el-button>
      </span>
    </el-dialog>

  </div>
</template>
<script>
export default {
  data() {
    return {
      ruleForm: {
        name: '',
        user: '',
        password:'',
        value1:[],
        
      },
      options:[
        {value:'内容管理',label:'内容管理'},
        {value:'审核管理',label:'审核管理'},
        {value:'用户管理',label:'用户管理'}
      ],
      rules: {
        name: [
          {message: '请输入活动名称', trigger: 'blur' },
          {min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
        ],
        user: [
          {message: '请选择活动区域', trigger: 'change' }
        ],
        password: [
          {message: '请选择活动区域', trigger: 'change' }
        ]
      }
    }
  },
  props:['dialogVisible'],
  methods:{
    handleClose(done) {
      this.$confirm('确认关闭？')
        .then(_ => {
          done();
        })
        .catch(_ => {});
    },
    closeFun(formName) {
      this.$refs[formName].resetFields();
      this.$emit('showFun')
    },
    AdduserFun(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          alert('submit!');
        } else {
          return false;
        }
      });
    }
  }
}
</script>
<style>


</style>